package gcosc.fun.hly.fastsso.config;

import gcosc.fun.hly.fastsso.filter.IPHandlerInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
@EnableWebMvc
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WebMvcConfig  implements WebMvcConfigurer {

    private final IPHandlerInterceptor ipHandlerInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(ipHandlerInterceptor)
                .addPathPatterns("/sso/**").order(0);
    }

}
